<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="/luntanshequ/Public/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="/luntanshequ/Public/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="/luntanshequ/Public/css/style.css" rel="stylesheet" type="text/css" />
<link href="/luntanshequ/Public/lib/font-awesome/font-awesome.min.css" rel="stylesheet" type="text/css" />
<!--[if IE 7]>
<link href="lib/font-awesome/font-awesome-ie7.min.css" rel="stylesheet" type="text/css" />
<![endif]-->
<link href="/luntanshequ/Public/lib/iconfont/iconfont.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>分类管理</title>
</head>
<body>
<nav class="breadcrumb"><i class="iconfont">&#xf012b;</i> 首页 <span class="c-gray en">&gt;</span> 资讯管理 <span class="c-gray en">&gt;</span> 分类管理 <a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="icon-refresh"></i></a></nav>
<div class="pd-20 text-c">
  <form class="Huiform" action="<?php echo U('admin/category/categoryadd');?>" method="post">
    上级栏目： <span class="select-box" style="width:250px">
    <select class="select" id="sel_Sub" name="fid" >
       <option value="0" selected>自己就是顶级分类</option>
      <?php foreach ($category as $key => $value) { ?>
          <option value="<?php echo ($value['id']); ?>"><?php echo ($value['cname']); ?></option>
        <?php
 } ?>
        
    </select>
    </span>
    <input class="input-text" style="width:250px" type="text" value="" name="cname" placeholder="输入分类" id="article-class-val">
    <button type="submit" class="btn btn-success"><i class="icon-plus"></i> 添加</button>
  </form>
  <div class="article-class-list cl mt-20">
    <table class="table table-border table-bordered table-hover table-bg">
      <thead>
        <tr class="text-c">
          <th width="25"><input type="checkbox" name="" value=""></th>
          <th width="80">ID</th>
          <th width="80">排序</th>
          <th>分类名称</th>
          <th width="70">操作</th>
        </tr>
      </thead>
      <tbody>
        <?php  foreach ($category as $key => $value) { ?>
                <tr class="text-c">
                  <td><input type="checkbox" name="" value=""></td>
                  <td><?php echo ($value['id']); ?></td>
                  <td>1</td>
                  <td class="text-l">|-<?php echo ($value['cname']); ?></td>
                  <td class="f-14"><a title="编辑" href="<?php echo U('admin/category/categoryedit',array('id'=>$value['id']));?>"  style="text-decoration:none"><i class="icon-edit"></i></a> <a title="删除" href="javascript:;" onclick="category_del(this,<?php echo ($value['id']); ?>)" class="ml-5" style="text-decoration:none"><i class="icon-trash"></i></a></td>
                </tr>
            <?php
 } ?>
      </tbody>
    </table>
  </div>
</div>
<script type="text/javascript" src="/luntanshequ/Public/lib/jquery.min.js"></script> 
<script type="text/javascript" src="/luntanshequ/Public/lib/Validform_v5.3.2.js"></script> 
<!-- <script type="text/javascript" src="/luntanshequ/Public/lib/layer1.8/layer.min.js"></script>  -->
<script type="text/javascript" src="/luntanshequ/Public/layer/layer.js"></script>
<script type="text/javascript" src="/luntanshequ/Public/lib/laypage/laypage.js"></script> 
<script type="text/javascript" src="/luntanshequ/Public/js/H-ui.js"></script> 
<script type="text/javascript" src="/luntanshequ/Public/js/H-ui.admin.js"></script> 
<script type="text/javascript" src="/luntanshequ/Public/js/H-ui.admin.doc.js"></script>
<script type="text/javascript">
// 类别的删除
function category_del(obj,id){
  layer.confirm('确认要删除吗？',function(index){
    var currentObj = $(obj);
    var categoryId = id;
    var layerObj = layer;
    $.ajax({
      url: '<?php echo U("admin/category/categorydelete");?>',
      type: 'POST',
      dataType: 'json',
      data: {cateid: categoryId},
      success:function(data){
        if(data.error == 0){
          currentObj.parents("tr").remove();
          layerObj.msg(data.msg,{icon:6,time:1000});
        }else if( data.error == 1 ){
          layerObj.msg(data.msg,{icon:5,time:1000});
        }

      },
      error:function(){

      },
    })
    
    
  });
}

</script>
</body>
</html>